//页面初始化
window.onload =function (){

    /**
     *  1. 页面初始化
     *     select table 初值
     *  2. 事件绑定
     *
     * */


     initSelect();
     initTable();

    var btnQuery= document.getElementById('btnQuery');

    btnQuery.onclick = btnQueryClick;
}

function  btnQueryClick(){
     alert('实现搜索功能');
}

function initSelect(){


     var sltMajor= document.getElementById('sltMajor');

    for (var i = 0; i < majors.length; i++) {

        var opt = '<option>'+majors[i].name+'</option>';
        sltMajor.innerHTML+=opt;

    }
}


function initTable(){

   var tblStudent= document.getElementById('tblStudent');

    for (var i = 0; i <students.length ; i++) {

        var tRow= '<tr><td>'+students[i].stuNO+'</td>' +
            '<td>'+students[i].name+'</td>' +
            '<td>'+students[i].major+'</td>' +
            '</tr>'

        tblStudent.innerHTML+=tRow;

    }

}